package com.example.appforpatient.fragment;

import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.appforpatient.R;
import com.example.appforpatient.adapter.ServiceConnector;
import com.example.appforpatient.adapter.ServiceConnector.PatientInfo;

public class FragmentProfile extends Fragment {

	public static Fragment newInstance(Context context) {
		FragmentProfile f = new FragmentProfile();

		return f;
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		ViewGroup root = (ViewGroup) inflater.inflate(
				R.layout.fragment_profile, null);

		PatientInfo pi = ServiceConnector.getSingleton().getPatientInfo();

		TextView tvName = (TextView) root.findViewById(R.id.tvName );
		tvName.setText(pi.name);
		
		TextView tvShowAge = (TextView) root.findViewById(R.id.tvShowAge);
		tvShowAge.setText(pi.age.toString());

		TextView tvShowBirthday = (TextView) root
				.findViewById(R.id.tvShowBirthday);
		tvShowBirthday.setText(pi.birthday);

		TextView tvShowAddress = (TextView) root
				.findViewById(R.id.mh_address);
		tvShowAddress.setText(pi.address);

		TextView tvShowArea = (TextView) root
				.findViewById(R.id.tvShowArea);
		tvShowArea.setText(pi.area);

		TextView tvShowPhone = (TextView) root
				.findViewById(R.id.tvShowPhone);
		tvShowPhone.setText(pi.phone);

		TextView tvShowEmercy = (TextView) root
				.findViewById(R.id.tvShowEmercy);
		tvShowEmercy.setText(pi.emergencyContact);
		
		TextView tvShowDoctor = (TextView) root
				.findViewById(R.id.tvShowDoctor);
		tvShowDoctor.setText(pi.doctor);		
		return root;
	}

}